Computer program product for using build status indicators in connection with building of complex computer programs from source code parts

ABSTRACT

A computer program product for dynamically scheduling the building of computer programs from source code parts which may have dependencies which require that some parts be compiled before others. A list of source code parts and dependencies is dynamically created as compilation of the parts is attempted. The build status for each part is tracked. The list is repeatedly processed until none of the build status fields changes during an entire pass through the list. The source code parts which cannot be compiled and integrated in the build for reasons such as circular compilation dependencies or references to non-existing, prerequisite source code parts will be identified by this process.

This is a continuation of application Ser. No. 08/257,621 filed on Jun.8, 1994 now U.S. Pat. No. 5,513,357 which is a divisional of applicationSer. No. 08/016,622 filed on Feb. 12, 1993, now U.S. Pat. No. 5,375,239.

TECHNICAL FIELD

The present invention relates generally to scheduling the building ofcomputer programs from component parts and, in particular, fordynamically and efficiently scheduling the building of complex computerprograms from source code parts accessed dynamically from a source codeparts library.

BACKGROUND OF THE INVENTION

In developing a complex computer program, it is efficient to create theprogram by integrating several smaller parts rather than writing asingle large program. The source code parts used in building the programcan be created and maintained individually in a program library andaccessed as desired. In building the complex program, each of itscomponent source code parts is accessed and scheduled for compilationprior to integration into an executable program. For successfulconstruction of the complex program, the several component source codeparts required must be scheduled for compilation in the correctsequence. Logically independent source code parts must be scheduled forcompilation before their dependent source code parts can be compiled.

Scheduling the compilation of source code parts without dependencies isrelatively simple. However, the scheduling becomes complex whencompilation dependencies and prerequisites between source code partsarise as the compilation proceeds. This may happen because in the sourcecode parts library, parts are maintained independently of each other onan ongoing basis. This may result in a modification to one source codepart introducing dependencies on other source code parts which areunknown to the scheduler until the scheduler attempts to compile thepart. In this event, if the scheduler cannot dynamically adapt to thenew dependencies, the construction of the program will be stopped untilthe dependency problem is resolved.

Other problems may be encountered when scheduling the compilation ofsource code parts. The parts may have circular, prerequisite compilationdependencies or have prerequisites on non-existing source code parts. Acircular prerequisite compilation dependency occurs where, for example,part A cannot be compiled until after the compilation of part B, andpart B cannot be compiled until after the compilation of part A. Whensuch circular compilation dependency occurs, an infinite scheduling loopwill develop without the computer program being built.

Consequently, in order to efficiently construct a computer program fromsource code parts, the parts must be scheduled correctly, thecompilation dependencies which arise between parts during compilationmust be dynamically adapted by the scheduler irate the schedule, and,when source code parts become involved in circular scheduling loops, theconstruction of the application must be stopped in a timely manner.

In the prior art, one way of integrating source code parts in building acomputer program is to use a MAKE facility. With a MAKE facility, makefiles are created by specifying in a file the source code parts that areneeded in the build, and the order in which the source code parts shouldbe made. With this approach to building a complex program the user mustcontinually intervene in the process to keep the make files up-to-dateand syntactically correct. This task is difficult when many source codeparts are being modified, added to or deleted from a large source codeparts library.

An alternative prior ad approach is to use a source code parts schedulerwhich is capable of parsing the source code of each source code partprior to scheduling its compilation. This enables source code partsdependencies to be determined and thereby enable the scheduling of thecompilation of the parts. A scheduler of this type requires a parserwhich is identical to the parser in each compiler that it supports.While this approach may be adequate where the scheduler supports sourcecode parts coded in the same source language, it is inefficient whereparts are written in several languages and are in the same partslibrary. Also, even if a parser was provided in a scheduler, by the timethe actual compile is performed based on information learned fromparsing the code, a compilation dependency may change due to source codeparts maintenance, and therefore the information obtained for theschedule can become out of date.

Consequently the above two approaches are unsatisfactory. Additionally,neither approach is capable of dynamically adapting the schedule todependencies between source code parts that become known as the partsare compiled.

U.S. Pat. No. 4,852,001 assigned to Hitachi, Ltd. discloses a jobscheduling method for scheduling of jobs to various resources, whereineach workload of a job is allocated to each time unit along a time axisin units of job and resource type. The patent relates to timing of jobsand allocation of time and does not address the building of applicationprograms and scheduling of dependencies.

U.S. Pat. No. 4,791,554 assigned to Hitachi, Ltd. discloses a computersystem for parallel execution of several tasks by sharing severalresources in a database of a computer. The patent discusses "deadlock"due to the sharing of common resources and provides information to delaythe start of a task that has the possibility of the deadlock. Thispatent also is not concerned with the problem addressed by the presentinvention.

U.S. Pat. No. 4,658,351 assigned to Wang Laboratories, Inc. discloses atask control method and apparatus for controlling interactive,concurrent execution of several general purpose data processing tasks ina data processing system. The task manager includes several task queueswith each queue corresponding to a relative priority level for executionof the task. Tasks are executed in a sequence depending upon therelative priorities of the task queues and upon the sequential locationof task control blocks in a task queue. This patent also does notaddress the problem which this present invention solves.

The problem of scheduling the building of a computer program byscheduling the compilation of several interdependent source code partsfrom a library of parts, wherein a part may have several compilationdependencies unknown to the scheduler at the beginning of the build, hasnot been adequately addressed in the prior all. Also, no known means,presently is available for dynamically adapting to new compilationsource code part dependencies which become known as the compilationproceeds. Also, no known means is available for efficiently recognizingthe existence of circular compilation dependencies among source codeparts that may frustrate attempts to build the application.

SUMMARY OF THE INVENTION

The present invention provides a method and means for dynamicallyscheduling the building of a computer program from several source codeparts accessed from a computer parts library. Scheduling is done basedon information returned to the scheduler from the compiler as eachsource code part is compiled.

A primary object of the present invention is to detect critical failuresoccurring during compilation of complex computer programs from multiplesource code parts.

A further object of the present invention is to provide a process forcompiling complex computer programs where compilation continues evenwhere it has not been possible to compile a particular source code part.

The invention is more particularly defined as a method for locatingcritical failures during the building of complex computer programs whichincludes the steps of listing the source code parts required forbuilding the program, marking each part with a build status indicator,repetitively traversing the source code parts on the listing, attemptingto compile each part as it is traversed according to the build statusindicator and the parts dependencies and, where successful, replacingthe build status indicator with a successful compilation indicator andstopping the traversing process only when no indicators are changedduring a traversal of all the parts on the listing.

A further feature of the invention is the ability to add source codeparts to the list while attempting to compile the parts.

In addition, listing of source code part dependencies are provided witheach source part having a dependency on other parts so as to provide anindicator as to when a part is capable of being compiled.

The method of the present invention can be more particularlycharacterized in the following steps:

i) establishing an initial list of known source code parts required tobuild the application,

ii) marking each source code part on the list with a build statusindicator,

iii) scheduling the compiling of each source code part on the list oneat a time, if they require compilation,

iv) if the compilation of a source code part of step iii) is successful,changing the build status indicator of the source code part to indicatea successful compilation,

v) if compilation of a source code part of step iii) is halted by areference to a second source code part whose compilation is aprerequisite to the compilation of the first source code part, and ifthe second source code part is not on the list, then adding the secondsource code part to the list and setting the build status indicator onthe second source code part to indicate that the second source code partis to be compiled, and retaining unchanged the build status indicator onthe first source code part and move to the next source code part on thelist,

vi) if the compilation of a source code part is halted by failure tocompile for a reason other than the reason of step iv) above, settingthe build status indicator on the source code part to indicate that thesource code part has failed to be compiled and move to the next sourcecode part on the list,

vii) repeating steps iii), iv) and v), iterating from start to end ofthe list until no change in the status indicators occurs during a fulltraverse of the list of source code parts,

viii) on completion of vii) above, stopping the compilations andreporting the current status of the build status indicator for eachsource code part. At this point, source code parts which weresuccessfully scheduled can be distinguished from those that were not.

The scheduler provided by the present invention will schedule thecompilation of the source code parts as required including schedulingnew parts as the build proceeds. If circular compiling dependenciesbetween source code parts arise during the compilation causing aninfinite scheduling loop, the method of the present invention will alsoefficiently stop the compilation.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates the method of scheduling of LIST OF PARTS and LIST OFDEPENDENCIES as provided by the present invention.

FIG. 2 is a flow chart illustrating the scheduling of source code partsfor compilation with the implementation of build status indicators.

DETAILED DESCRIPTION OF THE INVENTION

A preferred embodiment of the present invention, shown in FIG. 1 hasbeen implemented to build complex computer application programs fromsource code parts created and maintained in a computer program library.A source code part is simply a computer program maintained in sourcecode format which can be accessed and integrated into building a largercomputer program.

Successful building of an application program from source code partsrequires that the various parts be scheduled for compilation in correctorder. For example, if source code part A depends upon source code partB for compilation, part B must be compiled prior to the compilation ofpart A.

At the start of the build process many of the compilation dependenciesare known. However, because of ongoing file maintenance in the library,new compilation dependencies may be established which are unknown to thescheduler. These dependencies will appear as the source code parts arecompiled.

For an efficient build, the scheduler must be able to adapt the scheduledynamically to any new dependencies that become known duringcompilation. Also, if as a result of the compilation, an infinitecircular compilation dependency occurs between two or more parts, thenthe scheduler must be able to stop the build process.

In the preferred embodiment of the present invention, a pre-scheduler isused to create LISTS OF PARTS by part type (see FIG. 2, block 20). Thepre-scheduler puts similar types of files on the same LIST OF PARTS:e.g., logical files and physical files, because of their potential forestablishing circular compilation dependencies on each other or betweenthemselves while other part types are placed on different lists.

As shown in FIG. 1, source code parts for building an applicationprogram are represented as entries 11, 12, 13, 14 which comprise a LISTOF PARTS. Similarly, the dependencies for a given source code part areshown as entries 15, 16 in a LIST OF DEPENDENCIES. In the LIST OF PARTSand the LIST OF DEPENDENCIES the order of the source code parts on eachlist does not matter. However, each source code part on the list has ascheduling status indicator 4 which indicates to the scheduler thecompilation status of the part (see FIG. 2, block 22). Referring to FIG.2, the status indicator can be set at any one of the following:

1. TO₋₋ BE₋₋ BUILT: On encountering this status indicator, the schedulerdetermines whether or not the part can be scheduled for compilation(block 26). The scheduler will check all the known compilation dependedparts of the present part to determine whether or not the statusindicator of all its compilation dependencies are set at BUILT (block28). If they are all indicating BUILT, meaning that they have all beenpreviously compiled, the scheduler will then schedule the compilation ofthe present part (block 30). If the status indicator on one or morecompilation dependencies are set at TO₋₋ BE₋₋ BUILT and these parts areon the list (block 32), the scheduler will delay the scheduling of thepresent part and go to another part on the list (block 34). If all thedepended source code parts required are not on the list, the schedulerwill then add new parts to the list as they become known (blocks 36 and44).

2. BUILT: A part having this indicator has been scheduled and compiled(block 37). A part will also have this indicator if the part does notrequire compiling.

3. FAILED: On encountering this indicator, the scheduler will stop thescheduling and/or compiling of the part. This is because either the partitself or one or more of its dependencies had FAILED to compile due tosyntax or other errors. When a part fails to compile, the schedulermarks the part as FAILED (block 38) and any parts that were dependent onthat part will not compile and will also be marked as FAILED by thescheduler.

In scheduling the parts for compilation, the scheduler will iterativelytraverse the LIST OF PARTS and LIST OF DEPENDENCIES, if any, one part ata time in a loop back to the start of the LIST OF PARTS as illustratedin FIG. 1. As it traverses the list, the scheduler checks each sourcecode part status indicator (blocks 24, 40 and 34). When the statusindicator shows either BUILT or FAILED (block 26), the scheduler willnot do anything further with that part. When a TO₋₋ BE₋₋ BUILT statusindicator is encountered, the scheduler will check whether the part canbe now compiled (block 28) and if it can, the part will be scheduled forcompilation (block 30).

The scheduler will repetitively traverse the list (block 41) untilduring an entire traversal of the list no more parts are processed. Thiswould be indicated by no changes in any status indicator from TO₋₋ BE₋₋BUILT to BUILT or FAILED during the traversal (block 41). Once thisfinal traversal loop has been completed, the list of parts will containsource code parts that are compiled (BUILT), and source code parts thatare not (FAILED or TO₋₋ BE₋₋ BUILT). The parts that are not completed(parts with TO₋₋ BE₋₋ BUILT indicator on) are source code parts that areeither in a circular compilation dependency, dependent on parts within acircular dependency or refer to non-existing source code parts.

With reference to FIG. 1 and FIG. 2, the above method can be summarizedas follows:

1. At the start of the scheduling process, part A is examined. If thescheduling status flag is set at TO₋₋ BE₋₋ BUILT, and part A has nodependencies, part A is compiled, and the scheduling status indicator isset to BUILT.

2. Next part B is examined. Assume that the scheduling status flag isset at TO₋₋ BE₋₋ BUILT. Since part B is dependent on the priorcompilation of part C which has not yet been processed, part B cannot becompiled on this traverse. Therefore its status indicator is notchanged.

3. Pad C is next examined. If the scheduling status flag is TO₋₋ BE₋₋BUILT, and since there are no known dependencies, part C is compiled,and the status indicator on part C is set to BUILT.

4. As a result of this first traverse through the list, at least onepart in the list had its scheduling status flag changed. The flags forparts A and C were changed from TO₋₋ BE₋₋ BUILT to BUILT. The schedulerwill go back to the top of the list and repeat steps 1, 2, and 3 above.

5. Pad A is now examined again. The scheduling status flag is now BUILTfrom the previous traverse so nothing is done on this traverse.

6. Pad B is examined. On this occasion, the scheduling status flag isTO₋₋ BE₋₋ BUILT, but the dependencies A and C are all now BUILT, so partB is now compiled, and the scheduling status indicator is set to BUILT.

7. Pad C is examined. From the previous traverse the status indicatorwas set at BUILT, so nothing is done on C.

The traverse through the list begins again from part A through part C,but since no parts scheduling status flags are changed during this thirdtraverse through the loop, the process is stopped. However, if a newdependency were found during the compilation, the part would be added tothe end of the list after part C and thus become part of the schedulertraversal list. The cycle would repeat until there is no change in anystatus indicator flag.

The method of the present invention can be represented in pseudo codeformat as shown in Table 1.

                  TABLE 1                                                         ______________________________________                                        Pseudo Code                                                                   ______________________________________                                        DO FOREVER                                                                    Set PART.sub.-- STATUS.sub.-- CHANGED flag to FALSE                           Point to the first part in the LIST OF PARTS                                  DO WHILE the last part in the LIST OF PARTS is not                            visited                                                                       IF the current PART is TO.sub.-- BE.sub.-- BUILT THEN                         IF the part does not need to be compiled THEN                                 Set SCHEDULING.sub.-- STATUS flag to BUILT                                    ELSE                                                                          Compile the part                                                              Add any new dependencies learned from the compiler                            to the parts dependency list, and to the LIST OF                              PARTS (if necessary), with their SCHEDULING.sub.--                            STATUS flag set to TO.sub.-- BE.sub.-- BUILT.                                 IF there are no dependencies that are TO.sub.-- BE.sub.-- BUILT               THEN                                                                          Set the current part's SCHEDULING.sub.-- STATUS flag                          to BUILT.                                                                     END                                                                           END /* IF */                                                                  END /* IF */                                                                  IF the current part's SCHEDULING.sub.-- STATUS flag has                       changed THEN                                                                  Set PART.sub.-- STATUS.sub.-- CHANGED flag to TRUE                            END /* IF */                                                                  END /* DO WHILE */                                                            **********************************************************                    |* Determine if there is a cycle      *|                    **********************************************************                    IF the PART.sub.-- STATUS.sub.-- CHANGED flag is FALSE THEN                   Point to the first part in the LIST OF PARTS                                  DO WHILE the last part in the LIST OF PARTS is not                            visited                                                                       IF the current part's SCHEDULING.sub.-- STATUS is                             TO.sub.-- BE.sub.-- BUILT THEN                                                Issue a warning stating this part is dependent on                             a part that can't be built.                                                   END /* IF */                                                                  END /* DO WHILE */                                                            Leave this method.                                                            END /* IF */                                                                  END /* DO FOREVER */                                                          ______________________________________                                    

In contrast to the before-the-fact scheduling approaches used in theprior art with either a make file facility or a program parserincorporated in the scheduler, the present invention is anafter-the-fact scheduling approach based on information provided by thecompiler as the parts are compiled. The result of the present inventionis an efficient method for scheduling parts in building the computerapplication program and for identifying source code parts which cannotbe compiled because of circular compilation dependency or because of thenonexistence of a prerequisite source code part (FIG. 2, block 44).

In implementing the present invention in a computer system to build anapplication program from several source code parts, computer memory isrequired only to maintain a lists of parts and lists of dependent parts.No extra memory or computer processing capacity are required to identifyparts in infinite circular dependencies, nor is any extra processingcapacity needed to handle new, dependent parts which become known as thecompilation proceeds.

What is claimed is:
 1. A computer program product comprising a computerreadable medium having computer program logic recorded thereon forenabling a processor in a computer system to build complex computerprograms from source code parts, said source code parts comprisingobjects obtained from a program library, said computer program logiccomprising:means for enabling said processor to list in a first listingsource code parts required for building a complex computer program,means for enabling said processor to mark each source code part in saidfirst listing with a build status indicator indicative of a status ofcompilation, means for enabling said processor to repetitively traversesaid first listing, means for enabling said processor to attempt tocompile each said source code part according to said build statusindicator as said first listing is traversed, and if said attemptedcompilation of said source code part is successful, replacing said buildstatus indicator for said source code part with a successful compilationindicator, and means for enabling said processor to stop said traversingof said first listing when a traverse of said first listing creates aspecific state of said build status indicators.
 2. The computer programproduct of claim 1, said computer program logic further comprising meansfor enabling said processor to add source code parts from said programlibrary to said first listing when an attempt to compile a source codepart identifies a dependency on a source code part not included in saidfirst listing but available in said program library.